﻿@using MVC_da.Models.Database
@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    //取控制器传过来的分类数据 并且强制转换类型
    var categorys = ViewData["category"] as List<Category>;
    var goods = ViewData["xinwens"] as List<Xinwen>;
    var cid = Convert.ToInt32(ViewData["cid"]);
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>NewWebsite</title>
    <link rel="stylesheet" href="~/css/index.css">
</head>

<body>
    <!--导航栏-->
    <div class="content">
        <div id="nav">
            <div class="nav_main">
                <a @(cid > 0 ? "" : "class=cur")= href="/index.html">全部</a>
                @{
                    //完成分类数据查询和渲染

                    //3.页面拿到数据进行显示
                    //使用C#代码
                    //遍历循环 分类数据
                    if (categorys != null)
                    {
                        foreach (var item in categorys)
                        {
                            //输出分类信息
                            <a @(cid == item.Cateid ? "class=cur" : "")= href="/index.html?cid=@item.Cateid">@item.Catename</a>
                        }
                    }

                }
                <input type="button" value="搜索" id="search">
                <input type="text" id="content" placeholder="请输入查找的内容">
            </div>
        </div>
        @RenderBody()
        <div class="footer">
            <p>
                <a href="javascript:void(0)">关于NewWebsite</a>
                |
                <a href="javascript:void(0)">诚聘英才</a>
                |
                <a href="javascript:void(0)">商务合作</a>
                |
                <a href="javascript:void(0)">法律声明</a>
                |
                <a href="javascript:void(0)">帮助中心</a>
                |
                <a href="javascript:void(0)">作者投稿</a>
                |
                <a href="javascript:void(0)">联系我们</a>
                |
                <a href="javascript:void(0)">友情链接</a>
            </p>
            <p>
                Copyright©www.newwebsite.com&nbsp;&nbsp;All&nbsp;&nbsp;Rights&nbsp;&nbsp;Reserved&nbsp;版权所有&nbsp;&nbsp;
                <a href="">京ICP备xxxxxxxx-2号</a>
            </p>
            <p>本站所收录新闻来源、社区话题、新闻评论均属其个人学习行为，不代表本站立场。</p>
        </div>
    </div>
    <script></script>
</body>
</html>